package com.yjhealth.libs.businessdemo.business;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.yjhealth.libs.businessdemo.R;
import com.yjhealth.libs.commonlib.base.activity.BaseActivity;
import com.yjhealth.libs.core.core.activity.CoreActivity;
import com.yjhealth.libs.core.log.LogUtil;
import com.yjhealth.libs.pay.PayResult;
import com.yjhealth.libs.pay.PayResultListener;
import com.yjhealth.libs.pay.PayManager;
import com.yjhealth.libs.pay.dic.PayTypeDic;

public class DemoPayActivity extends BaseActivity {
    private Button btnPay;
    private PayManager payUtil;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.businessdemo_activity_demo_pay);

        payUtil = new PayManager(activity, payResultListener);

        btnPay = findViewById(R.id.btnPay);
        btnPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                payUtil.pay(PayTypeDic.TYPE_ALI, "");
            }
        });
    }


    private PayResultListener payResultListener = new PayResultListener() {
        @Override
        public void start(String payType, String appId, String payInfo) {

        }

        @Override
        public void success(String payType, PayResult resultVo) {
            LogUtil.d("DemoPayActivity;success;payType=" + payType);
        }

        @Override
        public void error(String payType, PayResult resultVo) {
            LogUtil.d("DemoPayActivity;error;payType=" + payType);
        }

        @Override
        public void cancel(String payType, PayResult resultVo) {
            LogUtil.d("DemoPayActivity;cancel;payType=" + payType);
        }

        @Override
        public void unknow(String payType, PayResult resultVo) {

        }
    };

    @Override
    protected void onRefreshView() {

    }
}
